local lvbuwuwei2022 = fk.CreateSkill{
  name = "lvbuwuwei2022",
}

lvbuwuwei2022:addEffect("targetmod", {
  anim_type = "offensive",
  residue_func = function(self, player, skill, scope)
    if skill.trueName == "slash_skill" and scope == Player.HistoryPhase and player:hasSkill(self.name) then
      return 2
    end
  end,
})

lvbuwuwei2022:addEffect(fk.AfterCardTargetDeclared, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and not player.dead and
      (data.card.trueName == "duel" or data.card.trueName == "slash") and #data:getExtraTargets() > 0
  end,
  on_use = function (self, event, target, player, data)
      local room = player.room
      local targets = room:getOtherPlayers(player)
      local tos = player.room:askToChoosePlayers(player, {
        min_num = 1,
        max_num = 2,
        targets = data:getExtraTargets(),
        skill_name = self.name,
        prompt = "#lvbuwuwei2022-choose:::"..data.card:toLogString(),
        cancelable = true,
      })
      if #tos > 0 then
        room:sortByAction(tos)
        for _, p in ipairs(tos) do
          data:addTarget(p)
        end
      end
  end,
})

return lvbuwuwei2022

